#include "include.h"

#ifdef USE_QT

#include "qt_mainwindow_adapter.h"

#include "compile/debug_memoryleaks"
using namespace gui;
using namespace qtgui;


MainWindowQT::MainWindowQT(GuiEventDispatcher* const eventdispatcher, ActionInvoker* const _invoker,  QWidget *parent/*=0*/)
: QMainWindow(parent), invokerAdapter(_invoker)
{
    ui.setupUi(this);
	
	assert(eventdispatcher);
    setGuiEventDispatcher(eventdispatcher);
	
	
    qt_connectActions();
}

MainWindowQT::~MainWindowQT()
{
    setGuiEventDispatcher(NULL);
}


void MainWindowQT::setGuiEventDispatcher(GuiEventDispatcher* const guieventdispatcher)
{
    if (ui.guieventdispatcher)
    {
        ui.guieventdispatcher->setDelegate(guieventdispatcher);
    }
}



void MainWindowQT::qt_connectActions()
{
    QObject::connect(ui.actionAbout, SIGNAL(triggered()), &invokerAdapter, SLOT(slotAbout()));
    QObject::connect(ui.actionExit, SIGNAL(triggered()), &invokerAdapter, SLOT(slotExit()));
    
	//TODO...connectActions sig/slots
}



#endif
